function P_AFNA=Pclogit_AFNA(Y_AFNA,X_AFNA,Z_AFNA,b_AFNA)

choice=1:13;
ns=numel(choice);

Y=sortrows(Y_AFNA,[1,2]);
Y=Y(:,3:end);

X=sortrows(X_AFNA,[1,2]);
X=[ones(size(X,1),1),X(:,3:end)];

Z_AFNA=sortrows(Z_AFNA,[1,2,3]);
Z=zeros(size(Y,1),size(Z_AFNA,2),ns);
for i=4:size(Z_AFNA,2)
    Z(:,i,:)=reshape(Z_AFNA(:,i),ns,[])';
end
Z(:,1:3,:)=[];

baseAlt=1;

P_AFNA = pclogit(b_AFNA,Y,X,Z,baseAlt);














